using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using RoboTrocity;
using RoboTrocity.Code.ObjectStates;

namespace RoboTrocity {
    class Bullet : MovableObject {

		int damage;
		private int range; //how far the bullet travels before stopping
		//maybe a type of damage

        public Bullet():this(new Vector2(1,0)) {}

		public Bullet(Vector2 _velocity) : 
			this (Point.Zero, _velocity, 1) {}

		public Bullet(Vector2 _velocity, int _damage) : 
			this (Point.Zero, _velocity, _damage) {}

		public Bullet(Point _position, Vector2 _velocity, int _damage) : base(_position) {
			Velocity = _velocity;
			Damage = _damage;
			HasGravity = false;
			range = 500;
			Height = 20;
			Width = 20;
			addState(new BulletFlyingState(this, new Sprite("bullet1")));
			addState(new BulletCollidingState(this, new Sprite("bullet1")));
			currentState = getState(typeof (BulletFlyingState));
		}

		public override void collideWith(Terrain terrain) {
			  ((BulletState)CurrentState).Collide();
		}

    	public override void collideWith(Enemy enemy) {
			//damage the enemy here too
    		((BulletState)CurrentState).Collide();
    	}

		public int Damage {
			get { return damage; }
			set { damage = value; }
		}

		public int Range {
			get { return range; }
			set { range = value; }
		}

		public override void Update(float timeElapsed) {
			//base.Update(timeElapsed);
			CurrentState.Update(timeElapsed);	
		}

		public override float ObjectDepth {
			get { return 0.0f; }
		}
    }
}
